81 #define XMC_I2S_CH_OVERSAMPLING (4UL) 132 channel->
PSCR = 0xFFFFFFFFUL;
159 uint32_t sclk_cycles_system_word_length_temp;
164 uint8_t best_error = 64U;
166 XMC_ASSERT(
"XMC_I2S_CH_Init: data_delayed_sclk_periods value not valid",(sclk_cycles_system_word_length > 0U) && (sclk_cycles_system_word_length < 65U));
169 for (dctq_temp =1U; dctq_temp < 33U ; dctq_temp++)
171 for (pctq_temp =1U; pctq_temp < 5U ; pctq_temp++)
173 sclk_cycles_system_word_length_temp = ((uint32_t)dctq_temp) * ((uint32_t)pctq_temp);
174 if(sclk_cycles_system_word_length_temp == sclk_cycles_system_word_length)
180 if (sclk_cycles_system_word_length_temp > sclk_cycles_system_word_length)
182 error = (uint8_t)(sclk_cycles_system_word_length_temp - sclk_cycles_system_word_length);
186 error = (uint8_t)(sclk_cycles_system_word_length - sclk_cycles_system_word_length_temp);
189 if(error < best_error)
215 channel->
TBUF[(uint32_t)channel_number << 4] = data;
219 channel->
IN[(uint32_t)channel_number << 4] = data;
231 retval = (uint16_t)channel->
RBUF;
235 retval = (uint16_t)channel->
OUTR;
260 channel->
CCR |= (
event&0x1fc00U);
266 channel->
CCR &= (uint32_t)~(event&0x1fc00U);
267 channel->
PCR_IISMode &= (uint32_t)~((event >> 2U) & 0x8070U);
uint32_t XMC_SCU_CLOCK_GetPeripheralClockFrequency(void)
void XMC_I2S_CH_SetSystemWordLength(XMC_USIC_CH_t *const channel, uint32_t sclk_cycles_system_word_length)
__IO uint32_t PCR_IISMode
__STATIC_INLINE void XMC_USIC_CH_SetMode(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_OPERATING_MODE_t mode)
#define USIC_CH_BRG_CTQSEL_Msk
__STATIC_INLINE XMC_USIC_CH_TBUF_STATUS_t XMC_USIC_CH_GetTransmitBufferStatus(XMC_USIC_CH_t *const channel)
#define USIC_CH_TCSR_TDEN_Pos
#define USIC_CH_TCSR_WLEMD_Msk
#define USIC_CH_TCSR_FLEMD_Msk
I2S_CH configuration structure.
XMC_USIC_CH_STATUS_t XMC_USIC_CH_SetBaudrate(XMC_USIC_CH_t *const channel, uint32_t rate, uint32_t oversampling)
#define USIC_CH_BRG_PCTQ_Pos
#define USIC_CH_TCSR_TDSSM_Msk
XMC_I2S_CH_BUS_MODE_t bus_mode
uint16_t XMC_I2S_CH_GetReceivedData(XMC_USIC_CH_t *const channel)
#define XMC_I2S_CH_OVERSAMPLING
I2S driver for XMC microcontroller family.
#define XMC_ASSERT(msg, exp)
#define USIC_CH_TCSR_SELMD_Msk
#define USIC_CH_TCSR_WAMD_Msk
#define USIC_CH_SCTR_TRM_Pos
#define USIC_CH_BRG_PCTQ_Msk
#define USIC_CH_BRG_PPPEN_Msk
void XMC_I2S_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event)
enum XMC_I2S_CH_STATUS XMC_I2S_CH_STATUS_t
I2S Status.
void XMC_I2S_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data, const XMC_I2S_CH_CHANNEL_t channel_number)
#define USIC_CH_PCR_IISMode_TDEL_Pos
void XMC_USIC_CH_Enable(XMC_USIC_CH_t *const channel)
XMC_I2S_CH_STATUS_t XMC_I2S_CH_Stop(XMC_USIC_CH_t *const channel)
#define USIC_CH_TCSR_HPCMD_Msk
#define USIC_CH_BRG_CTQSEL_Pos
__STATIC_INLINE void XMC_I2S_CH_ClearStatusFlag(XMC_USIC_CH_t *const channel, const uint32_t flag)
#define USIC_CH_PCR_IISMode_WAGEN_Msk
#define USIC_CH_TBCTR_SIZE_Msk
XMC_I2S_CH_STATUS_t XMC_I2S_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate)
#define USIC_CH_SCTR_SDIR_Msk
#define USIC_CH_SCTR_WLE_Pos
#define USIC_CH_RBCTR_SIZE_Msk
#define USIC_CH_BRG_DCTQ_Pos
#define USIC_CH_SCTR_FLE_Pos
uint8_t data_delayed_sclk_periods
void XMC_I2S_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event)
enum XMC_I2S_CH_CHANNEL XMC_I2S_CH_CHANNEL_t
Defines the Polarity of the WA in the SELO output lines in relation to the internal WA signal...
void XMC_I2S_CH_Init(XMC_USIC_CH_t *const channel, const XMC_I2S_CH_CONFIG_t *const config)
#define USIC_CH_PCR_IISMode_DTEN_Msk
#define USIC_CH_BRG_DCTQ_Msk
XMC_I2S_CH_WA_POLARITY_t wa_inversion